<%@ page import="ru.spbu.mm.diploma.client.service.SessionService" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk" %>
<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%
    if (!SessionService.getInstance().checkRights((Integer) SessionService.getInstance().getSession().getAttribute("USERROLE_ID"), "sec_projects.jsp")) {
        response.sendRedirect("accessError.faces");
    }
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Projects.</title>
    <link href="css/css_project_table.css" rel="stylesheet" type="text/css"/>
</head>

<body>

<div class="container">
    <div class="header"><!-- end .header -->
        <f:view>
        <h:form>
        <table width="960" border="1">
            <tr>
                <td width="840">&nbsp;</td>
                <td width="100">


                    <h:commandButton action="#{loginController.logOut}" value="LogOut Intra"
                                     accesskey="l" immediate="true" styleClass="submit">
                    </h:commandButton>
                    </h:form>

                </td>
            </tr>
        </table>
    </div>
    <div class="content">


        Projects:


        <h:form id="projectsTable">
            <rich:dataTable value="#{projectController.projects}" var="project"
                            onRowMouseOver="this.style.backgroundColor='#B5F3FB'"
                            onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'"
                            width="960">

                <f:facet name="header">
                    <rich:columnGroup>

                        <rich:column colspan="10">
                            <h:outputText value="Projects"/>
                        </rich:column>
                        <rich:column breakBefore="true">
                            <h:outputText value="#{msg.projectName}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectDescription}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectStartDate}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectCurrentPhase}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectPhaseProgress}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectPhaseStartDate}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectPhaseEndDate}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectProgress}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectEndDate}"/>
                        </rich:column>
                        <rich:column>
                            <h:outputText value="#{msg.projectAction}"/>
                        </rich:column>

                    </rich:columnGroup>
                </f:facet>

                <rich:column>
                    <h:outputText value="#{project.name}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.description}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.startDate}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.currentPhase}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.phaseProgress}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.phaseStartDate}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.phaseEndDate}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.progress}"/>
                </rich:column>
                <rich:column>
                    <h:outputText value="#{project.endDate}"/>
                </rich:column>
                <rich:column>
                    <h:commandLink value="#{msg.projectActionInfo}" action="#{projectController.getInfo}">
                        <f:setPropertyActionListener target="#{projectController.project}" value="#{project}"/>
                    </h:commandLink>
                </rich:column>

            </rich:dataTable>
        </h:form>
        </f:view>
        <!-- end .content --></div>
    <div class="footer">
        <p>Нижний колонтитул</p>
        <!-- end .footer --></div>
    <!-- end .container --></div>
</body>
</html>